In cloud environments with virtual machines (VMs) running using a growable disk image, the size of this image increases over time. Usually, for shrinking the image, which means to reduce the space used on a storage device, the VM has to be shut down (or the disk has to be disconnected) or the VM user has to perform some actions. Currently, no technology is available which provides a method for shrinking an image on a disk at runtime without involvement of the VM operating system.
U.S. Pat. No. 7,647,468 B2 describes a method and mechanism for performing maintenance operations including compaction, de-fragmentation, and merging on a virtual storage device of a virtual machine. Architectures for computing devices and software allow a single computing device to run a plurality of partitions, each of which can be used to instantiate a virtual machine to in turn host an instance of an operating system. In such a computing device, a storage hardware device of the computing device such as a RAM memory or a hard disk drive memory may be dynamically assigned to a particular partition so that the particular partition can directly control such storage hardware device. Such particular partition, then, is in effect a host that provides storage capabilities as a storage host partition (SHP). Similarly, such SHP provides storage services to another partition which is in effect a client that consumes such capabilities as a storage client partition (SCP). Thus, the SCP and the SHP communicate to accomplish storage-related operations.
The virtual storage device of an SCP as well as the corresponding storage image file as maintained by the SHP might have a relatively large storage capacity. However, the storage capacity of the virtual storage device likely is not fully occupied by data, and instead may contain significant if not large amounts of empty space or space with null data and/or data no longer referenced therein.
Such null data in the virtual storage device need not be represented within the corresponding storage image file, at least on a byte-for-byte basis. By not storing null data from the virtual storage device in the corresponding storage image file, then, such storage image file may be stored on the storage hardware device as a smaller if not much smaller file.
In U.S. Pat. No. 7,647,468 B2 a method is described, which provides with regard to a computing device partitioned to include a host partition (HP) instantiated at least in part to provide storage capabilities, and also to include a client partition (CP) instantiated at least in part to consume such storage capabilities of the HP in the form of a virtual storage device at the CP. The HP implements the virtual storage device of the CP as an image file on a physical storage device. The method compacts the image file at the HP while the CP is employing the corresponding virtual storage device. The method compacts the image file on the HP while the CP is employing the corresponding virtual storage device. For this task, a direct communication with an entity in the CP is mandatory.